#include"depsort.h"

char * checkdep(struct sqliet3 *sqliet3dbptr, struct obstack *obstack,char *pkgname)
{
	
	struct obstack *obstackptr = malloc(sizeof(obstackptr));
	struct obstack *tmpobstack = malloc(sizeof(tmpobstack));
	struct sqliet3_stmt *sqliet3_stmt = malloc(sizeof(sqliet3_stmt)); 
	char *pkgn = malloc(sizeof(pkgname)
	int c;
	char getpkgqp1[63] = "SELECT deps FROM \"main\" WHERE (SELECT pkgname from \"main\") LIKE \'" ;
	char getpkgqp2[3] = "\' ;" ;
	char *qstr;
	char *tmpdeplist;
	FILE *memptr;
	init_obstack(obstackptr);
	memcopy( (char *) pkgn, (char *) pkgname, sizeof(pkgname)); 
	addto_obstack(obstackptr,getpkgqp1[0]);
	addto_obstack(obstackptr,pkgn);
	addto_obstack(obstackptr, getpkgqp2[0]);
	obstack_finish(obstackptr);	
	
	
	
	qstr = (char *) obstackptr;

	 sqlite3_prepare(sqlietdbptr,qstr,sqliet3_stmt,NULL); 
	obstack_free(obstackptr);
	init_obstack(obstackptr);
	init_obstack(tmpobstack);
	while( (c=sqliet3_step(sqliet3_stmt)) != SQLIET_DONE){
		c = sqliet3_step(sqliet3_stmt);
	}
	
	obstack_ptr_grow(tmpobstack,( sqlite3_column_text(sqlite3_stmt, DEPCOLUMN) ) );
	c = obstack_object_size(tmpobstack);
	obstack_finish(tmpobstack);
	qstr = (char *) tmpobstack;
	
	if(qstr == "none"){
		obstack_free(tmpobstack);		
		return tpmdeplist;
	}
	memptr = open_memstream( tmpobstack, c, "r");
	
	
	checkdep(*sqliet3dbptr,obstack

